package com.tanhua.model.vo;

import com.tanhua.model.mongo.TestOption;
import com.tanhua.model.mongo.TestQuestion;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class OptionVo {

    private String id;    //选项id
    private String questionId; //所属问题id
    private String option;        //选项
    private String nature; //性格


    private String question;   //问题名称



    public static OptionVo init(TestOption testOption, TestQuestion testQuestion) {
        OptionVo vo = new OptionVo();
        //设置选项数据
        BeanUtils.copyProperties(testOption, vo);
        vo.setId(testOption.getId().toHexString());

        //设置用户数据
        BeanUtils.copyProperties(testQuestion, vo);

        return vo;
    }

}
